<style lang="scss">
  @import './index.scss';
</style>

<template>
  <div class="ga-container">
    <div class="ga-user">
      <!--二维码 弹窗-->
      <!-- <div v-show="modal">
        <div class="ga-mask animated fadeIn" @click="modal=false"></div>

        <div class="ga-alert">
          <image class="img-box img" mode="aspectFit" width="404" height="401" src="/static/images/test/wx.png"></image>
        </div>
      </div> -->
      <!-- 顶部-->
      <div class="user-head">
        <!-- 头像-->
        <ul class="head-box">
          <li>
          <image class="img-box" mode="aspectFill" :src="WxUser.avatarUrl"></image>
          </li>
          <li class="con">
          <p class="p1">{{WxUser.nickName}}</p>
          </li>
        </ul>
        <!-- 头像END-->
        <div class="nav-box">
          <a href="" class="item">
            <p>{{useraccount.integral}}分</p>
            <p>积分 <i class="icon-angle-right"></i></p>
          </a>
          <a href="/pages/myTickets/main" class="item">
            <p>{{useraccount.coupon}}张</p>
            <p>优惠券 <i class="icon-angle-right"></i></p>
          </a>
          <a href="/pages/recharge/main" class="item">
            <p>{{useraccount.balance}}元</p>
            <p>余额 . 充值 <i class="icon-angle-right"></i></p>
          </a>
        </div>
      </div>
      <!-- 顶部end-->
      <h1 class="h1">
        <span class="f28">我的订单</span>
        <a href="/pages/myOrder/main?status=0" class="gGray f24 pull-right">
            查看全部
            <i class="icon-angle-right f26"></i>
        </a>
      </h1>

      <div class="menu-box">
        <a class="item" href="/pages/myOrder/main?status=1">
          <i class="icon icon1"></i>
          <p>待付款</p>
        </a>
        <a class="item" href="/pages/myOrder/main?status=2">
          <i class="icon icon2"></i>
          <p>已付款</p>
        </a>
        <a class="item" href="/pages/myOrder/main?status=3">
          <i class="icon icon3"></i>
          <p>已发货</p>
        </a>
        <a class="item" href="/pages/myOrder/main?status=4">
          <i class="icon icon4"></i>
          <p>已完成</p>
        </a>
        <!-- <a class="item" href="#">
          <i class="icon icon5"></i>
          <p>退货/款</p>
        </a> -->
      </div>

      <div class="ga-arrow-cell mt20">
        <a href="../nearbyShop/main" class="item">
          <span>附近门店</span>
          <span class="icon-angle-right"></span>
        </a>
        <a href="../storeorderlist/main?status=0" class="item">
          <span>门店订单</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../distribution/main" class="item" v-if="useraccount.usertype == 2">
          <span>分销中心</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../distributionApply/main" class="item" v-else>
          <span>分销申请</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../withDraw/main" class="item">
          <span>余额提现</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../address/main" class="item">
          <span>地址管理</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../mycollect/main" class="item">
          <span>我的收藏</span>
          <i class="icon-angle-right"></i>
        </a>
        <!-- <a href="../orderComment/main" class="item">
          <span>商品评价</span>
          <i class="icon-angle-right"></i>
        </a> -->
        <!-- <a href="#" class="item">
          <span>常见问题</span>
          <i class="icon-angle-right"></i>
        </a>
        <a href="../about/main" class="item">
          <span>关于我们</span>
          <i class="icon-angle-right"></i>
        </a> -->
        <button class="item" open-type="contact">
          <span>联系客服</span>
          <i class="icon-angle-right"></i>
        </button>
          <!-- <view class="item">
            <span>联系客服</span>
            <i class="icon-angle-right"></i>
            <contact-button  :session-from="$store.state.sid">
            </contact-button>
          </view> -->
      </div>
    </div>
  </div>
</template>

<script>
import {isLogin} from '@/utils/handleLogin'
  export default {
    data () {
      return {
        modal: false,
        WxUser:{},
        useraccount: {
          integral: 0,
          coupon: 0,
          balance: 0,
          usertype: 1,
        },
        share_config: {},
        sid: ''
      }
    },
    methods: {
      /**
      * 路由跳转
      */
      bindNavigateTo (url) {
          wx.navigateTo({
            url
          })
      },
      bindSwitchTab (url) {
          wx.switchTab({
            url
          })
      },
      async load () {
         this.$_util.ajax.post('https://guo-a.com/mapi/user/getuseraccount?token=' + this.$store.state.Token).then((res) => {
             if(res.code === 200){
                this.useraccount={
                  integral: res.data.total_score,
                  coupon: res.data.usercoupon,
                  balance: res.data.total_money,
                  usertype: res.data.usertype
                }
             }
         })
      }
    },
    onShow () {
       isLogin(()=>{
          this.WxUser = this.$store.state.WxUser
          this.sid = this.$store.state.sid
          this.load()
       })

    },
  }
</script>


